package com.horay.statemachiedemo.multi.action;

import com.horay.statemachiedemo.multi.enums.ComplexState;
import com.horay.statemachiedemo.multi.event.ComplexEvent;
import com.horay.statemachiedemo.multi.model.Form;
import lombok.extern.slf4j.Slf4j;
import org.springframework.statemachine.StateContext;
import org.springframework.statemachine.action.Action;

/**
 * Class description
 *
 * @author heyingcheng
 * @date 2020/10/23
 */
@Slf4j
public class ComplexChoiceSuccessAction implements Action<ComplexState, ComplexEvent> {

    @Override
    public void execute(StateContext<ComplexState, ComplexEvent> context) {
        Form form = context.getMessage().getHeaders().get(Form.class.getName(), Form.class);
        log.info("Into ComplexChoiceSuccessAction Form:[{}], State:[{}]", form, context.getStateMachine().getState().getId());
    }

}
